﻿using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace groep20_festival
{
    /// <summary>
    /// declaratie van connectie, toewijzen van sqlstatement
    /// </summary>
    public partial class festival : System.Web.UI.MasterPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            string myConnectionString = "Data Source=(LocalDB)\\v11.0;AttachDbFilename=c:\\databank\\groep20_festivals.mdf;Integrated Security=True;Connect Timeout=30"; 

            SqlCommand cmd = new SqlCommand("SELECT [fest_naam] FROM [Festivals] where [fest_ID] = (SELECT fest_id FROM ( SELECT *, ROW_NUMBER() OVER (ORDER BY fest_datum) as row FROM Festivals ) a WHERE row = 1)", new SqlConnection(myConnectionString));
            cmd.Connection.Open();
            
            lblCommingUp.Text = cmd.ExecuteScalar().ToString(); 
            cmd.Connection.Close();

        }
    }
}